<?php
include_once $_SERVER['DOCUMENT_ROOT'] . '/lib/Sanpham.php';
$sanphamOb = new Sanpham();
$sanpham = $sanphamOb->laySanPhamKM($_GET['id']);
?>
<table width="700px" border="0" align="center">
  <tr>
    <td width="200px" rowspan="6" align="center" valign="top">
        <img class="img" width="150px" src="<?php echo $sanpham['hinhanh'] ?>" alt="img" />
    </td>
    <td class="text10" width="500px" align="left">
        <strong style="color:#F00" id="ten_sp_<?php echo $_GET['id'] ?>"><?php echo $sanpham['ten'] ?></strong>
    </td>
  </tr>
  <tr>
      <td align="right"><a class="them-gio-hang" rel="<?php echo $_GET['id'] ?>" href="javascript:void(0)">
              <p style="margin-right: 70px;"><img width="20px" height="20px" src="images/cart.png" />Thêm vào giỏ</p></a></td>
  </tr>
  <tr>
    <td><strike><b>Giá gốc:</b> <?php echo number_format($sanpham['gia']) ?> <b>VNĐ</b></strike></td>
  </tr>
  <tr>
    <td><b>Giá khuyến mãi:</b> <?php echo $sanpham['giaKM'] ?> <b>VNĐ</b></td>
  </tr>
  <tr>
    <td><b>SIZE:</b> <?php echo $sanpham['size'] ?></td>
  </tr>
  <tr>
    <td><b>Màu:</b> <?php echo $sanpham['mau'] ?></td>
  </tr>
  <tr>
    <td><b>Chất liệu:</b> <?php echo $sanpham['chatlieu'] ?></td>
  </tr>
  <tr>
      <td colspan="2"><b><u>Thông tin chi tiết sản phẩm:</u></b></td>
  </tr>
  <tr>
      <td colspan="2"><?php echo $sanpham['mota'] ?></td>
  </tr>
</table>
<script type="text/javascript">
    $(document).ready(function(){
        $(".them-gio-hang").click(function(){
            var pID = $(this).attr('rel'); 
            var tenP = $("#ten_sp_"+pID).text();
            // Ajax them vao gio hang san pham tuong ung
            $.post(
            '/ajax/themgiohang.php',
            {
                id:pID,
                ten:tenP
            },
            function(data) {
                alert(data);
            }
        )
        });
    });
</script>


